package com.playball.lottery.frm.yhzx;

import com.playball.lottery.ApplicationData;
import com.playball.lottery.R;
import com.playball.lottery.nt.GetJsonData;


import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.TextView;

public class RechargeByWeb extends Activity {

	private WebView webView;
	private Button top_title_back;
	private Button top_title_refres;
	private TextView textView;

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			if (webView.canGoBack()) {
				webView.goBack();
			} else {
				finish();
			}
			return true;
		} else {
			return super.onKeyDown(keyCode, event);
		}
	}

	public void onResume() {
		super.onResume();
		
	}

	public void onPause() {
		super.onPause();
		
	}

	@SuppressLint("NewApi")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.adv_zx);

		textView = (TextView) findViewById(R.id.top_title_info);
		textView.setText("充值");

		top_title_refres = (Button) findViewById(R.id.top_title_refres);
		top_title_refres.setVisibility(View.GONE);
		top_title_back = (Button) findViewById(R.id.top_title_back);
		top_title_back.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});

		webView = (WebView) findViewById(R.id.webzx);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
		webView.getSettings().setSupportZoom(true);
		webView.getSettings().setEnableSmoothTransition(true);
		// 设置出现缩放工具 
		webView.getSettings().setBuiltInZoomControls(true);
		//扩大比例的缩放
		webView.getSettings().setUseWideViewPort(true);
		//自适应屏幕
		webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
		webView.getSettings().setLoadWithOverviewMode(true);
//		webView.setWebViewClient(new WebViewClient() {
//			@Override
//			public boolean shouldOverrideUrlLoading(WebView view, String url) {
//				view.loadUrl(url);
//				return true;
//			}
//		});

		webView.loadUrl("http://azure.dodofs.com/user/Recharge_Mobile.html?userid="+ApplicationData.getInstance().getUserID());
	}

}
